﻿@model  HANS_BackStage.Model.DbModel.Backstage_admin
@{
    ViewBag.Title = "个人中心";
      var FileUploadModel = ViewData["FaceImag"] as HANS_Base.Model.FileUploadModel;
}
<div class="x_panel">
    <!--beginHead-->
    <div class="x_title">
        <h2>个人中心 <small>HANS</small></h2>
        <ul class="nav navbar-right panel_toolbox">
            <li>
                <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
            </li>
        </ul>
        <div class="clearfix"></div>
    </div>
    <!--endHead-->
    <div class="x_content">
        <!--beginForm-->
        @using (Html.BeginForm("MyProfile", "Account", FormMethod.Post,
                                                new { @class = "form-horizontal form-label-left js-form-submit", @novalidate = "",enctype = "multipart/form-data", id = "fileupload" }))
        {
            @Html.AntiForgeryToken()
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    头像
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class=“kv-avatar center-block text-center” style=“ width ：200px ”>
                        <input id="FaceIma" name="FaceIma" type="file" class=“file-loading” required>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    账号<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Name, new { @class = "form-control col-md-7 col-xs-12", @readOnly = "readonly" })
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    昵称<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Nickname, new { @class = "form-control col-md-7 col-xs-12" })
                </div>
                @Html.ValidationMessageFor(i => i.Nickname, null, new { @class = "text-danger" })

            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    真实姓名<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Truename, new { @class = "form-control col-md-7 col-xs-12" })
                </div>
                @Html.ValidationMessageFor(i => i.Truename, null, new { @class = "text-danger" })
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    性别<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.HiddenFor(i => i.Sex)<!--"js-select-sex"[针对性别，必须有个隐藏，从JS赋值]-->
                    <select class="form-control js-select-sex" id="sex">
                        <option value="1">男</option>
                        <option value="2">女</option>
                        <option value="0">不详</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    年龄<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.TextBoxFor(i => i.Age, new { @class = "form-control col-md-7 col-xs-12", @type = "number", @min = "0", @max = "100" })
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    密码<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.Password("Password", null,new { @class = "form-control col-md-7 col-xs-12",@placeholder = "如不改密码，请放空！"  })
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">
                    新密码<span class="required">*</span>
                </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    @Html.Password("NewPassword",null ,new { @class = "form-control col-md-7 col-xs-12", @placeholder = "如不改密码，请放空！" })
                </div>
            </div>
            <div class="ln_solid"></div><!--条横线-->
                            <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                    <button type="submit" class="btn btn-success">保存</button>
                                    <a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
                                </div>
                            </div>
                            }
        <!--endForm-->
    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        $(function () {
            //$('#Roles').val($('.js-select-role').val());
            changeSelect('#sex',@Model.Sex);
            changeValue('#Roles','.js-select-role');
        })
         var changeStringRole = { selectClass: ".js-select-role", selectValString: "#Roles" };
        $('.js-select-role').change(changeStringRole, SetChangeSelectString);//角色更改赋值

        var changeStringSex = { selectClass: ".js-select-sex", selectValString: "#Sex" };
        $('.js-select-sex').change(changeStringSex, SetChangeSelectString);//性别更改赋值

        $('#FaceIma').fileinput(@Html.Raw(FileUploadModel.ToJson()));
    </script>
}